package ovm.entity;

import javax.persistence.*;
import java.sql.Timestamp;
import java.util.Date;

/**
 * Created by IntelliJ IDEA.
 * User: Jokser
 * Date: 26.05.12
 * Time: 8:15
 * To change this template use File | Settings | File Templates.
 */
@javax.persistence.Table(name = "PRACTICE", schema = "DBO_DIPLOM_NEW", catalog = "")
@Entity
public class PracticeEntity {
    private Date dateStart;

    @javax.persistence.Column(name = "DATE_START")
    @Basic
    public Date getDateStart() {
        return dateStart;
    }

    public void setDateStart(Date dateStart) {
        this.dateStart = dateStart;
    }

    private Date dateEnd;

    @javax.persistence.Column(name = "DATE_END")
    @Basic
    public Date getDateEnd() {
        return dateEnd;
    }

    public void setDateEnd(Date dateEnd) {
        this.dateEnd = dateEnd;
    }

    private int id;

    @javax.persistence.Column(name = "ID")
    @Id
    @GeneratedValue(strategy = GenerationType.SEQUENCE)
    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        PracticeEntity that = (PracticeEntity) o;

        if (id != that.id) return false;
        if (dateEnd != null ? !dateEnd.equals(that.dateEnd) : that.dateEnd != null) return false;
        if (dateStart != null ? !dateStart.equals(that.dateStart) : that.dateStart != null) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = dateStart != null ? dateStart.hashCode() : 0;
        result = 31 * result + (dateEnd != null ? dateEnd.hashCode() : 0);
        result = 31 * result + id;
        return result;
    }

    private CompanyEntity companyByCompany;

    @ManyToOne
    public
    @javax.persistence.JoinColumn(name = "COMPANY", referencedColumnName = "ID", nullable = false)
    CompanyEntity getCompanyByCompany() {
        return companyByCompany;
    }

    public void setCompanyByCompany(CompanyEntity companyByCompany) {
        this.companyByCompany = companyByCompany;
    }

    private PracticeTypeEntity practiceTypeByPracticeType;

    @ManyToOne
    public
    @javax.persistence.JoinColumn(name = "PRACTICE_TYPE", referencedColumnName = "ID", nullable = false)
    PracticeTypeEntity getPracticeTypeByPracticeType() {
        return practiceTypeByPracticeType;
    }

    public void setPracticeTypeByPracticeType(PracticeTypeEntity practiceTypeByPracticeType) {
        this.practiceTypeByPracticeType = practiceTypeByPracticeType;
    }

    private StudentEntity studentByStudent;

    @ManyToOne
    public
    @javax.persistence.JoinColumn(name = "STUDENT", referencedColumnName = "ID", nullable = false)
    StudentEntity getStudentByStudent() {
        return studentByStudent;
    }

    public void setStudentByStudent(StudentEntity studentByStudent) {
        this.studentByStudent = studentByStudent;
    }

    private TeacherEntity teacherByTeacher;

    @ManyToOne
    public
    @javax.persistence.JoinColumn(name = "TEACHER", referencedColumnName = "ID", nullable = false)
    TeacherEntity getTeacherByTeacher() {
        return teacherByTeacher;
    }

    public void setTeacherByTeacher(TeacherEntity teacherByTeacher) {
        this.teacherByTeacher = teacherByTeacher;
    }
}
